﻿//using System;
//using System.Collections.Generic;
//using Drill.Configuration;
//using NUnit.Framework;

//namespace Drill.Core
//{
//	[TestFixture]
//	public class RootPathProviderFactoryTests
//	{
//		[Test]
//		public void CanConstruct()
//		{
//			// Arrange
//			// Nothing to arrange.

//			// Act
//			IRootPathProviderFactory factory = new RootPathProviderFactory();

//			// Assert
//			Assert.That(factory, Is.Not.Null);
//		}

//		[Test]
//		public void CanCreateInstanceWithAssemblyQualifiedTypeNameArgument()
//		{
//			// Arrange
//			IRootPathProviderFactory factory = new RootPathProviderFactory();
//			string assemblyQualifiedTypeName = typeof (ExecutingDirectoryRootPathProvider).AssemblyQualifiedName;

//			// Act
//			IRootPathProvider pathProvider = factory.CreateInstance(assemblyQualifiedTypeName);

//			// Assert
//			Assert.That(pathProvider, Is.Not.Null);
//			Assert.That(pathProvider, Is.TypeOf<ExecutingDirectoryRootPathProvider>());
//		}

//		[ExpectedException(typeof(ArgumentNullException), ExpectedMessage = "assemblyQualifiedTypeName", MatchType = MessageMatch.Contains)]
//		[Test]
//		public void CannotCreateInstanceWithNullAssemblyQualifiedTypeNameArgument()
//		{
//			// Arrange
//			IRootPathProviderFactory factory = new RootPathProviderFactory();
//			string assemblyQualifiedTypeName = null;

//			// Act
//			// ReSharper disable ExpressionIsAlwaysNull
//			factory.CreateInstance(assemblyQualifiedTypeName);
//			// ReSharper restore ExpressionIsAlwaysNull

//			// Assert
//			// Nothing to assert because the test should throw an expected exception (see ExpectedException attribute).
//		}

//		[ExpectedException(typeof(ArgumentNullException), ExpectedMessage = "assemblyQualifiedTypeName", MatchType = MessageMatch.Contains)]
//		[Test]
//		public void CannotCreateInstanceWithEmptyAssemblyQualifiedTypeNameArgument()
//		{
//			// Arrange
//			IRootPathProviderFactory factory = new RootPathProviderFactory();
//			string assemblyQualifiedTypeName = string.Empty;

//			// Act
//			// ReSharper disable ExpressionIsAlwaysNull
//			factory.CreateInstance(assemblyQualifiedTypeName);
//			// ReSharper restore ExpressionIsAlwaysNull

//			// Assert
//			// Nothing to assert because the test should throw an expected exception (see ExpectedException attribute).
//		}

//		[ExpectedException(typeof(ArgumentNullException), ExpectedMessage = "assemblyQualifiedTypeName", MatchType = MessageMatch.Contains)]
//		[Test]
//		public void CannotCreateInstanceWithwhitespaceAssemblyQualifiedTypeNameArgument()
//		{
//			// Arrange
//			IRootPathProviderFactory factory = new RootPathProviderFactory();
//			const string assemblyQualifiedTypeName = "   ";

//			// Act
//			// ReSharper disable ExpressionIsAlwaysNull
//			factory.CreateInstance(assemblyQualifiedTypeName);
//			// ReSharper restore ExpressionIsAlwaysNull

//			// Assert
//			// Nothing to assert because the test should throw an expected exception (see ExpectedException attribute).
//		}

//		[ExpectedException(typeof(ArgumentNullException), ExpectedMessage = "rootPathProviderConfig", MatchType = MessageMatch.Contains)]
//		[Test]
//		public void CannotCreateInstanceWithNullPathProviderConfigArgument()
//		{
//			// Arrange
//			IRootPathProviderFactory factory = new RootPathProviderFactory();
//			IRootPathProviderConfiguration pathProviderConfig = null;

//			// Act
//			// ReSharper disable ExpressionIsAlwaysNull
//			factory.CreateInstance(pathProviderConfig);
//			// ReSharper restore ExpressionIsAlwaysNull

//			// Assert
//			// Nothing to assert because the test should throw an expected exception (see ExpectedException attribute).
//		}

//		[Test]
//		public void CannotCreateInstanceWithDisabledPathProviderConfigArgument()
//		{
//			// Arrange
//			IRootPathProviderFactory factory = new RootPathProviderFactory();
//			IRootPathProviderConfiguration pathProviderConfig =
//				new RootPathProviderConfiguration { Enabled = false };

//			// Act
//			IRootPathProvider pathProvider = factory.CreateInstance(pathProviderConfig);

//			// Assert
//			Assert.That(pathProvider, Is.Null);
//		}

//		[ExpectedException(typeof(ArgumentException), ExpectedMessage = "Type property cannot be null, empty or whitespace", MatchType = MessageMatch.Contains)]
//		[Test]
//		public void CannotCreateInstanceWithPathProviderConfigArgumentWithNullTypePropertyValue()
//		{
//			// Arrange
//			IRootPathProviderFactory factory = new RootPathProviderFactory();
//			IRootPathProviderConfiguration pathProviderConfig =
//				new RootPathProviderConfiguration { Enabled = true, Type = null };

//			// Act
//			factory.CreateInstance(pathProviderConfig);

//			// Assert
//			// Nothing to assert because the test should throw an expected exception (see ExpectedException attribute).
//		}

//		[ExpectedException(typeof(ArgumentException), ExpectedMessage = "Type property cannot be null, empty or whitespace", MatchType = MessageMatch.Contains)]
//		[Test]
//		public void CannotCreateInstanceWithPathProviderConfigArgumentWithEmptyTypePropertyValue()
//		{
//			// Arrange
//			IRootPathProviderFactory factory = new RootPathProviderFactory();
//			IRootPathProviderConfiguration pathProviderConfig =
//				new RootPathProviderConfiguration { Enabled = true, Type = string.Empty };

//			// Act
//			factory.CreateInstance(pathProviderConfig);

//			// Assert
//			// Nothing to assert because the test should throw an expected exception (see ExpectedException attribute).
//		}

//		[ExpectedException(typeof(ArgumentException), ExpectedMessage = "Type property cannot be null, empty or whitespace", MatchType = MessageMatch.Contains)]
//		[Test]
//		public void CannotCreateInstanceWithPathProviderConfigArgumentWithWhitespaceTypePropertyValue()
//		{
//			// Arrange
//			IRootPathProviderFactory factory = new RootPathProviderFactory();
//			IRootPathProviderConfiguration pathProviderConfig =
//				new RootPathProviderConfiguration { Enabled = true, Type = "   " };

//			// Act
//			factory.CreateInstance(pathProviderConfig);

//			// Assert
//			// Nothing to assert because the test should throw an expected exception (see ExpectedException attribute).
//		}

//		[Test]
//		public void CanCreateInstanceWithPathProviderConfigArgument()
//		{
//			// Arrange
//			string assemblyQualifiedTypeName = typeof(ExecutingDirectoryRootPathProvider).AssemblyQualifiedName;
//			IRootPathProviderFactory factory = new RootPathProviderFactory();
//			IRootPathProviderConfiguration pathProviderConfig =
//				new RootPathProviderConfiguration { Enabled = true, Type = assemblyQualifiedTypeName };

//			// Act
//			IRootPathProvider pathProvider = factory.CreateInstance(pathProviderConfig);

//			// Assert
//			Assert.That(pathProvider, Is.Not.Null);
//			Assert.That(pathProvider, Is.TypeOf<ExecutingDirectoryRootPathProvider>());
//		}

//		[Test]
//		public void CanCreateInstances()
//		{
//			// Arrange
//			string assemblyQualifiedTypeName = typeof(ExecutingDirectoryRootPathProvider).AssemblyQualifiedName;
//			IRootPathProviderConfigurationCollection pathProviderCollection =
//				new RootPathProviderConfigurationCollection
//					{
//						new RootPathProviderConfiguration { Enabled = true, Type = assemblyQualifiedTypeName }
//					  , null
//					  , new RootPathProviderConfiguration { Enabled = false, Type = assemblyQualifiedTypeName }
//					  , new RootPathProviderConfiguration { Enabled = true, Type = assemblyQualifiedTypeName }
//					};
//			IRootPathProviderFactory factory = new RootPathProviderFactory();

//			// Act
//			IList<IRootPathProvider> pathProviders = factory.CreateInstances(pathProviderCollection);

//			// Assert
//			Assert.That(pathProviders, Is.Not.Null);
//			Assert.That(pathProviders.Count, Is.EqualTo(2));
//			Assert.That(pathProviders[0], Is.TypeOf<ExecutingDirectoryRootPathProvider>());
//			Assert.That(pathProviders[1], Is.TypeOf<ExecutingDirectoryRootPathProvider>());
//		}
//	}
//}